package org.openclinic.repository;

import java.util.List;

import org.openclinic.domain.HealthProfessional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface HealthProfessionalRepository extends JpaRepository<HealthProfessional, Long> {
	
	@Query("FROM HealthProfessional WHERE bond = 3 ORDER BY name")
	List<HealthProfessional> findAllHealthProfessionals();

	@Query("SELECT hp FROM HealthProfessional hp JOIN hp.specialties hps WHERE hps.specialtyId = ?1")
	List<HealthProfessional> findBySpecialty(long specialtyId);
	
}
